import { Application } from 'egg';

export default (app: Application) => {
    const { STRING, CHAR, INTEGER } = app.Sequelize;
    const model = app.model.define('CloundMessage', {
        clound_message_id: { type: CHAR(32), primaryKey: true },//主键值
        fromUserId: CHAR(32),//发送方用户id
        toUserId: CHAR(32),//接收用户id
        objectName: STRING(15),//消息类型
        content: STRING(200),//消息内容
        channelType: STRING(20),//会话类型
        msgTimestamp: STRING(50),//会话时间戳
        msgUID: STRING(200),//消息id
        sensitiveType: INTEGER(2),//标识消息中是否含有敏感词
        source: STRING(15),//标识消息的发送源头
        groupUserIds: STRING(500),//群组中指定接收消息的用户 ID 数组
    }, { tableName: 't_clound_message' });
    return model;
}

export class CloundMessage {
    clound_message_id: string;
    fromUserId: string;
    toUserId: string;
    objectName: string;
    content: string;
    channelType: string;
    msgTimestamp: string;
    msgUID: string;
    sensitiveType: string;
    source: string;
    groupUserIds: string;
}